# import the necessary packages
import cv2 as cv

# load our image and convert it to grascale
image = cv.imread("orientation_example.jpg")
gray = cv.cvtColor(image, cv.COLOR_BGR2GRAY)

# load the face detactor and detect faces in the image
detector = cv.CascadeClassifier("haarcascade_frontalface_default.xml")
rects = detector.detectMultiScale(gray, scaleFactor=1.05, minNeighbors=9, minSize=(30, 30),
                                  flags=cv.CASCADE_SCALE_IMAGE)

# loop over the faces and draw a rectangle surrounding each
for (x, y, w, h) in rects:
    cv.rectangle(image, (x, y), (x + w, y + h), (0, 255, 0), 2)

# show the detected faces
cv.imshow("Faces", image)
cv.waitKey(0)
